﻿@using www.Controllers
@using www.Core.Contract.DataContract
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="hidden" id="hdnpage" />
<input type="hidden" id="hdncul" value="@Session["Culture"]" />
<script type="text/javascript">
    $().ready(function () {
        $("#hdnpage").val(1);
    });

    function LoadDataRecord() {
        $('div#loading').html('<p><img src="/Images/Design/loading.gif" style="width:100%; height:25px;position:relative;"></p>');
     
        $.ajax({
            type: 'Get',
            url: '@Url.Action("GetTechnologyNewsDataContract", "Home")',
            data: { page: parseInt($("#hdnpage").val()) + 1 },
            async: false,
            dataType: "html",
            success: function (data) {

                if (data != '') {
                    $("#NewsAll").append(data);
                    $("#hdnpage").val(parseInt($("#hdnpage").val()) + 1);
                }
            },
            error: function (xhr, ajaxOptions, thrownError) {
                //alert(xhr.status);
                //alert(thrownError);
            }
        });
        $('div#loading').empty();
    }

    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {

            LoadDataRecord();
        }
    });
</script>

<div class="content">
    <div class="default-left">
        <div id="NewsAll">
            @Html.Partial("_AjaxNewsList")
        </div>
        <div id="loading"></div>

    </div>
    <div class="default-right">
        <div id="readstory">
            @if (ViewBag.RelaxPhotoDataContracts != null)
            {
                foreach (var item in (List<RelaxPhotoDataContract>)ViewBag.RelaxPhotoDataContracts)
                {
                <div class="photo">
                    <div class="row">
                        <h3><b><a href="/Home/PhotoDetail/@Session["Culture"]/@item.Id/@item.Tag">@item.Name</a></b></h3>
                    </div>
                    <div class="photoimg">
                        <a href="/Home/PhotoDetail/@Session["Culture"]/@item.Id/@item.Tag">
                            <img src="/@item.Image" alt="@item.Name"/>
                        </a>
                    </div>
                </div>
                }
                <div class="watchmore">
                    <a href="/Home/Photo/@Session["Culture"]">@Utility.GetResource.GetResouceValue(Session["Culture"], "lblWatchMore")...</a>
                </div>
            }
        </div>

    </div>
</div>
